1. Field of the Invention
The present invention relates to a method for verifying a branch instruction prediction mechanism, and more particularly, to a method for verifying a branch target buffer (BTB) mechanism and an accessible recording medium for storing program thereof.
2. Description of the Related Art
In order to enhance operational efficiency, processors usually use pipeline structures and caches. Under such a structure, errors of fetch instructions will hinder the operational efficiency of the system. While executing a branch instruction, a processor predicts the address of the next instruction so as to access another instruction for executing a next step, such as decoding, in the pipeline. When the prediction is incorrect and the processor accesses a wrong instruction, all of the instructions in the pipeline should be removed and correct instructions need to be input into the pipeline. Accordingly, the branch prediction has great impact on the operational efficiency of the system.
In conventional branch prediction technology, branch target buffer (BTB) mechanism is among the most common branch prediction mechanism. The BTB records the earlier branch instructions and data using the hardware so that the BTB may access a desired branch target instruction therefrom when next branch instruction matches one of the data. Accordingly, branch penalties can be reduced, and the operational delay of the system can be avoided thereby improving the operational efficiency of the system.
For central processing units (CPUs) or digital signal processors (DSPs), the BTB has direct influence on the operational efficiency of the system and the quantity of the data which are processed. Therefore, the efficiency of the BTB should be verified. A conventional verification method comprises various loop verification programs designed according to the structure of the BTB. An acceptable coverage, i.e. the verifiable ratio of status of all branch instructions, is obtained using some patterns. However, the design of the BTB and the structure of the verification method are dependent on each other, thus not all combinations of the branch instructions can be verified. Moreover, when different BTBs are used, additional verification programs are required to match these to-be-verified BTBs. The verification method cannot be designed until the BTB is known. Accordingly, the time for research and development should be extended.